<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 函数绑定:函数监听
        1.html属性中绑定事件
        2.DOM0对象属性绑定事件
    -->
    <!-- <button ondblclick="alert(我被点击了)">点击1</button> -->
    <button ondblclick="show()">点击1</button>
    
    <script>
        //函数show():弹出警告(别点我);
        function show(){  
            alert('别点我');
        }
          
    </script>
    <button class="btn1">点击2</button>
    <script>
        const btn1 = document.querySelector('.btn1');
        btn1.onclick = function(){
            alert('hello DOM0');
        }
    </script>
    <button class="btn2">点击3</button>
    <script>
        //获取节点
        const btn2 = document.querySelector('.btn2');
        //监听事件:对象.addEventListener('事件类型',事件处理程序,false);
        btn2.addEventListener('click',function(){
            alert('hello DOM2');
        },false);
    </script>
</body>
</html>